<include file="Public/header" />
<include file="Public/menu" />

<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            店铺订单
            <small>订单详细</small>
        </h1>

    </section>

    <!-- 内容 -->

    <section class="content"><div class="row"><div class="col-md-12"><div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li><a href="{:U('orders/orderDetail',array('id'=>$order_id))}" >订单详情</a></li>
            <li class="active"><a href="#tab_1" data-toggle="tab">订单备注</a></li>
            <li><a href="{:U('orders/orderLog',array('id'=>$order_id))}">订单日志</a></li>
            <li class="pull-right header">
            </li></ul>
        <div class="tab-content">

            <div class="tab-pane " id="tab_1">


                <form action="remarkOrder" method="post" accept-charset="UTF-8" class="form-horizontal" pjax-container="">


                    <div class="box-body">

                        <div class="form-group 1">


                            <label for="text" class="col-sm-2 control-label">订单备注：</label>

                            <div class="col-sm-6">
                                <textarea id="text" name="mark" class="form-control" rows="10" placeholder="备注"></textarea>
                                <input type="hidden" value="{$orDetail['product'][0]['order_id']}"  name='order_id'>
                            </div>
                        </div>


                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                      <div class="col-sm-2">

                    </div>
                        <div class="col-sm-6">

                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right">保存</button>
                            </div>

                            <div class="btn-group pull-left">
                                <input type="reset" class="btn btn-warning" value="清空">
                            </div>

                        </div>

                    </div>
                    <!-- /.box-footer -->
                </form>



            </div>

            <div class="tab-pane " id="tab_2" style="display: block">




                    <div class="box-body">

                        <div class="form-group 1">


                            <table class="table table-hover" id="tab" style="margin-left: 10px; width: 99%;">
                                <tbody>

                                <tr>
                                    <th>备注操作员</th>
                                    <th>备注内容</th>
                                    <th>时间</th>
                                </tr>

                                <if condition="$orderMark[0]['op_name'] neq ''">


                                <volist name="orderMark" id="Mitem">
                                    <tr>
                                        <td>{$Mitem.op_name}</td>
                                        <td>{$Mitem.mark_text}</td>
                                        <td>{$Mitem.add_time}</td>

                                    </tr>
                                </volist>
                                 </if>
                                </tbody></table>


                            <label for="text" class="col-sm-2 control-label">订单备注：</label>

                            <div class="col-sm-6">
                                <textarea id="markcontent" name="mark" class="form-control" rows="10" placeholder="备注"></textarea>
                                <input type="hidden" value="{$order_id}"  class='order_id'>
                            </div>
                        </div>


                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <div class="col-sm-2">

                        </div>
                        <div class="col-sm-6">

                            <div class="btn-group pull-right">
                                <button type="button" onclick="saveMark();" class="btn btn-info pull-right">保存</button>
                            </div>

                            <div class="btn-group pull-left">
                                <input type="reset" class="btn btn-warning" onclick="resetContent()" value="清空">
                            </div>

                        </div>

                    </div>
                    <!-- /.box-footer -->




            </div>


        </div>
    </div></div></div>

    </section>




</div>
<!-- 底部 -->
<include file="Public/common_footer" />
<script language="JavaScript">
  var _isAjaxSaved = false;
  function saveMark() {
	  if(_isAjaxSaved) return;
	  _isAjaxSaved = true;
	  var _markContent = $('#markcontent').val().trim();
	  if(_markContent == ""){
		alert("备注不允许为空！");
		_isAjaxSaved = false;
		return;
	  }
      $.ajax({
          url:"{:U('orders/saveMark')}",
          type:'post',
          data:{'mark':_markContent,'id':$('.order_id').val()},
          dataType:'json',
          success:function (data) {              
			  if(data.status ==1){
                  $("#tab").append(data.content);
              }
              if(data.status==0){
                  alert(data.msg);
              }
			  _isAjaxSaved = false;
          },
          error:function (err) {
              alert('参数错误');
			  _isAjaxSaved = false;
          }

      })
  }
  function resetContent() {
      $('#markcontent').val('');
  }
</script>